import Ajax from "./Ajax"

function loginApi(data) {
    return Ajax({
        url: '/user/login',
        method: 'POST',
        data
    })
}

function userInfoApi(id) {
    return Ajax({
        url: '/user/info',
        params: {id: id}
    })
}

// function userRightsApi(params) {
function userRightsApi(ids) {
    return Ajax({
        url: '/role/list/byids',
        params: {ids}
    })
}

function userMenuApi() {
    return Ajax({url: '/menu/list'})
}

// function collectionApi() {
//     return Ajax({url: '/analysis/collection'})
// }
const collectionApi = () => Ajax({url: '/analysis/collection'})

const userListApi = function(params) {
    return Ajax({
        url: '/user/list',
        params
    })
}

function fileUploadApi(data, uploadProgress) {
    return Ajax({
        url: '/file/upload/photo',
        method: 'POST',
        data,
        uploadProgress
    })
}

function base64UploadApi(data) {
    return Ajax({
        url: '/base64/upload',
        method: 'POST',
        data
    })
}

function deptApi() {
    return Ajax({url: '/dept/list'})
}

function roleApi() {
    return Ajax({url: '/role/list'})
}

export {
    loginApi,
    userInfoApi,
    userRightsApi,
    userMenuApi,
    collectionApi,
    userListApi,
    fileUploadApi,
    base64UploadApi,
    deptApi,
    roleApi
}